package com.itany.vo;

import com.itany.constant.ResponseConstant;

import java.io.Serializable;

/**
 * 行动的结果
 *
 * @author Tom
 * @date 2021/06/26
 */
public class ActionResult implements Serializable{
	
	private String msg;
	
	private Integer status;
	
	private Object data;

	public static ActionResult success () {
		ActionResult result = new ActionResult();
		result.status = ResponseConstant.RESPONSE_CODE_SUCCESS;
		result.msg = "成功";
		return result;
	}

	public static ActionResult success (Object o) {
		ActionResult result = new ActionResult();
		result.data = o;
		result.status = ResponseConstant.RESPONSE_CODE_SUCCESS;
		result.msg = "成功";
		return result;
	}

	public static ActionResult fail(String msg) {
		ActionResult result = new ActionResult();
		result.msg = msg;
		result.status = ResponseConstant.RESPONSE_CODE_FAIL;
		return result;
	}

	public static ActionResult userDisabled(String msg) {
		ActionResult result = new ActionResult();
		result.msg = msg;
		result.status = ResponseConstant.RESPONSE_CODE_USER_DISABLED;
		return result;
	}

	public static ActionResult userEnabled(String msg) {
		ActionResult result = new ActionResult();
		result.msg = msg;
		result.status = ResponseConstant.RESPONSE_CODE_USER_ENABLED;
		return result;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
}
